package com.woniuxy.handler;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.woniuxy.pojo.Maintain;
import com.woniuxy.service.MaintainService;
import lombok.Data;

@Data
@Controller
@RequestMapping("/maintain")
public class MaintainHandler {
	@Resource
	private MaintainService maintainService;

	@RequestMapping("/all")
	@ResponseBody
	public List<Maintain> all(int house_id) {
		return maintainService.findMaintainById(house_id);
	}

	// 更新设施信息
    @RequestMapping("/update")
    @ResponseBody
	public int update(int maintain_id) {
		return maintainService.UpdateStateByMaintainId(maintain_id);
	}

	// 添加设施维护
    @RequestMapping("/add")
    @ResponseBody
	public int add(Maintain maintain) {
		return maintainService.add(maintain);
	}
}
